<?php

namespace app\modules\backend\controllers;

use app\models\Setting;
use app\tools\Re;
use Yii;

class SettingController extends BaseController
{
    /**
     * @param string $type
     * @return array
     */
    public function actionSet(){
        $order_pay = Yii::$app->request->post('order_pay', 0);
        $user_auth_audit = Yii::$app->request->post('user_auth_audit', 0);
        $about = Yii::$app->request->post('about', '');
        $open_push_admin = Yii::$app->request->post('open_push_admin', 0);
        $setting = Setting::findOne(1);
        $setting->order_pay = $order_pay;
        $setting->user_auth_audit = $user_auth_audit;
        $setting->about = $about;
        $setting->open_push_admin = $open_push_admin;
        $setting->save();
        return Re::data();
    }

    public function actionGetSettingInfo(){
        $setting = Setting::findOne(1);
        return Re::data(['data' => $setting]);
    }
}
